local ffi = require'ffi'
local file = io.open('adiclockeval.h')
ffi.cdef(file:read('*all'))
file:close()
local lib = ffi.load'adiclockeval'
vids = ffi.new('int[1]')
pids = ffi.new('int[1]')
vids[0] = 0x0456
pids[0] = 0xEE25
local num = lib.FindHardware(vids, pids, 1)
print(num)
local handles = ffi.new('int[?]', num)
lib.GetHardwareHandles(handles)
for i=0, num-1 do
    ret = 1
    ret = lib.DownloadFirmware(handles[i], '.\\AD9910FWNR.hex')
    print(ret)
end
